<!DOCTYPE html>

<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>知识库-后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet"  th:href="@{/css/font.css}">
    <link rel="stylesheet"  th:href="@{/css/xadmin.css}">
    <script type="text/javascript" th:src="@{/plugins/jquery/jquery.min.js}" ></script>
    <script  th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message" style="background-color: #6496dc">后台系统-管理登录</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form" >

        <div class="layui-form-item">
            <div class="inputdiv">
                <i class="layui-icon layui-icon-username"></i>
                <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="用户名" class="layui-input" style="text-align: center;">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="inputdiv">
                <i class="layui-icon layui-icon-password"></i>
                <input type="password" name="password" lay-verify="title" autocomplete="off" placeholder="密码" class="layui-input" style="text-align: center;">
            </div>
        </div>
        <div class="layui-form-item">
            <div>
                <a onclick="x_admin_show('找回密码','/user/toForget',400,250)" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
            </div>
        </div>
        <div class="layui-form-item">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;background-color: #6496dc" type="submit">
        </div>

    </form>
</div>
<style>
    .inputdiv{
        display:flex;border: 1px solid #D2D2D2!important;background-color: #fff;height: 50px;line-height: 50px;padding: 0px 25px;
        border-radius: 25px;
    }
    .layui-input {
        border-style: none;height: 50px;line-height: 50px;
    }
</style>
<script>
    $(function  () {
        layui.use('form', function(){
            var form = layui.form;
            //监听提交
            form.on('submit(login)', function(data){
                /*
                  知识点：Ajax是客户端通过异步通信的方式访问服务端
                  JQuery Ajax访问服务端的示例
                  url：访问地址
                  data：请求数据
                  dataType:期待返回值是JSON数据
                  success：成功回调函数
               */
                $.ajax({
                    url:"/user/doLogin",
                    data:data.field,
                    dataType:"json",
                    success:function (data) {
                        if(data.code==10000){
                            layer.msg(data.msg,function(){
                                //前端跳转页面
                                location.href='/index/'+data.data.name
                            });
                        }
                        else{
                            layer.msg(data.msg);
                        }
                    }
                });
                return false;
            });
        });
    })


</script>



<!-- 底部结束 -->

</body>
</html>
